
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Spring 中的通知类型有哪些？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Spring 中的通知类型有哪些？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">在Spring AOP中，通知（Advice）的核心概念是什么？它解决了什么问题？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通知（Advice）是在特定的连接点（如方法调用）上执行的代码。它允许开发者在不修改目标方法代码的情况下，插入日志记录、安全检查、性能监控等横切关注点。</div>
          </div>
          <div class="card-source">来源: 文档开篇介绍部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">前置通知（Before Advice）的作用是什么？使用哪个注解来实现？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">前置通知在目标方法执行之前执行，常用于权限检查、日志记录等操作。它通过 `@Before` 注解来实现。</div>
          </div>
          <div class="card-source">来源: 1. 前置通知（Before Advice）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">后置通知（@After）和返回通知（@AfterReturning）在执行时机上有何关键区别？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">后置通知（@After）在目标方法执行之后执行，无论方法是成功返回还是抛出异常。而返回通知（@AfterReturning）仅在目标方法成功执行并返回后才执行。</div>
          </div>
          <div class="card-source">来源: 2. 后置通知（After Advice） 和 3. 返回通知（After Returning Advice）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">当目标方法抛出异常时，应该使用哪种类型的通知来处理？请说明其作用和实现注解。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">应该使用异常通知（After Throwing Advice）。它的作用是在目标方法抛出异常时执行，常用于异常处理或日志记录。实现该通知需要使用 `@AfterThrowing` 注解。</div>
          </div>
          <div class="card-source">来源: 4. 异常通知（After Throwing Advice）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">为什么环绕通知（Around Advice）被认为是Spring AOP中最强大的通知类型？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为它能够在目标方法执行前、执行后都进行操作，并且可以完全控制目标方法的执行，例如决定是否执行目标方法。这是其他通知类型不具备的能力。</div>
          </div>
          <div class="card-source">来源: 5. 环绕通知（Around Advice）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在实现环绕通知（@Around）时，必须使用哪个关键接口来控制目标方法的执行？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在实现环绕通知时，必须使用 `ProceedingJoinPoint` 接口，并通过调用其 `proceed()` 方法来执行目标方法。</div>
          </div>
          <div class="card-source">来源: 5. 环绕通知（Around Advice）</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
